package com.zzyl.controller.customer;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.controller.BaseController;
import com.zzyl.service.CustomerOrdersProjectService;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description CustomerOrdersController
 * @Author Lwj
 * @Date 2024-08-31-11:18
 */
@RestController
@RequestMapping("customer/orders/project")
@Slf4j
@Api(tags = "小程序服务项目")
public class CustomerOrdersProjectController extends BaseController {
    @Autowired
    private CustomerOrdersProjectService customerOrdersProjectService;

    /**
     * 分页查询
     *
     * @param name
     * @param pageNumb
     * @param pageSize
     * @param status
     * @return
     */
    @GetMapping("/page")
    @ApiOperation(value = "页查询护理项目列表")
    public ResponseResult<PageResponse<NursingProjectVo>> getPage(
            @ApiParam(value = "护理项目名称") String name,
            @ApiParam(value = "当前页码") @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNumb,
            @ApiParam(value = "每页显示数量") @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
            @ApiParam(value = "状态：0-禁用,1-启用") Integer status) {
        log.info("分页查询!");
        PageResponse<NursingProjectVo> pageResponse = customerOrdersProjectService.getPage(name, pageNumb, pageSize, status);
        return success(pageResponse);
    }

    /**
     * 查询护理项目信息
     *
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    @ApiOperation(value = "查询护理项目信息")
    public ResponseResult<NursingProjectVo> getCustomerNursingProject(@PathVariable @ApiParam(value = "查询护理项目id") Long id) {
        log.info("查询护理项目信息{}", id);
        NursingProjectVo nursingProjectVo = customerOrdersProjectService.getCustomerNursingProject(id);
        return success(nursingProjectVo);
    }
}
